//
//  contextSample.m
//  EFExtend
//
//  Created by mac on 15/5/23.
//  Copyright (c) 2015年 Eric. All rights reserved.
//

#import "contextSample.h"


@interface contextSample ()

@end

@implementation contextSample

- (void)dealloc
{
   
    HM_SUPER_DEALLOC();
}

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view.
    
    [self.customNavLeftBtn setImage:[UIImage imageNamed:@"back.png"] forState:UIControlStateNormal];
    [self.customNavLeftBtn setFrame:CGRectMakeBound(32, 32)];
    
    [self.customNavRightBtn setImage:[UIImage imageNamed:@"back.png"] forState:UIControlStateNormal];
    [self.customNavRightBtn setFrame:CGRectMakeBound(32, 32)];
    self.view.backgroundColor = [UIColor md_amber_100];
    
    [[[[[[UIView view] EFTag:2] EFBackgroundColor:[UIColor whiteColor]] EFFrame:CGRectMake(50, 10, 200,20)] EFOwner:self.view] showBackgroundShadowStyle:styleEmbossDarkLineArround];
    
    [[[[[[UIView view] EFTag:3] EFBackgroundColor:[UIColor whiteColor]] EFFrame:CGRectMake(50, 40, 200,20)] EFOwner:self.view] showBackgroundShadowStyle:styleEmbossDarkLineLeftBottom color:[UIColor redColor]];
    
    [[[[[[UIView view] EFTag:4] EFBackgroundColor:[UIColor whiteColor]] EFFrame:CGRectMake(50, 40*2, 200,20)] EFOwner:self.view] showBackgroundShadowStyle:styleEmbossDarkLineLeftTop];
    
    [[[[[[UIView view] EFTag:5] EFBackgroundColor:[UIColor whiteColor]] EFFrame:CGRectMake(50, 40*3, 200,20)] EFOwner:self.view] showBackgroundShadowStyle:styleEmbossDarkLineRightBottom];
    
    [[[[[[UIView view] EFTag:6] EFBackgroundColor:[UIColor whiteColor]] EFFrame:CGRectMake(50, 40*4, 200,20)] EFOwner:self.view] showBackgroundShadowStyle:styleEmbossDarkLineRightTop];
    
    [[[[[[UIView view] EFTag:100] EFBackgroundColor:[UIColor whiteColor]] EFFrame:CGRectMake(50, 40*5, 200,20)] EFOwner:self.view] showBackgroundShadowStyle:styleEmbossDarkLineRight];
    
    [[[[[[UIView view] EFTag:101] EFBackgroundColor:[UIColor whiteColor]] EFFrame:CGRectMake(50, 40*6, 200,20)] EFOwner:self.view] showBackgroundShadowStyle:styleEmbossDarkLineTop];
    
    [[[[[[UIView view] EFTag:102] EFBackgroundColor:[UIColor whiteColor]] EFFrame:CGRectMake(50, 40*7, 200,20)] EFOwner:self.view] showBackgroundShadowStyle:styleEmbossDarkLineLeft];
    
    [[[[[[UIView view] EFTag:103] EFBackgroundColor:[UIColor whiteColor]] EFFrame:CGRectMake(50, 40*8, 200,20)] EFOwner:self.view] showBackgroundShadowStyle:styleEmbossDarkLineBottom];
    
    [[[[[[UIView view] EFTag:200] EFBackgroundColor:[UIColor whiteColor]] EFFrame:CGRectMake(50, 40*9, 200,20)] EFOwner:self.view] showBackgroundShadowStyle:styleEmbossDarkLineLeftTopRight];
    
    [[[[[[UIView view] EFTag:201] EFBackgroundColor:[UIColor whiteColor]] EFFrame:CGRectMake(50, 40*10, 200,20)] EFOwner:self.view] showBackgroundShadowStyle:styleEmbossDarkLineLeftBottomRight];
    
    [[[[[[UIView view] EFTag:202] EFBackgroundColor:[UIColor whiteColor]] EFFrame:CGRectMake(50, 40*11, 200,20)] EFOwner:self.view] showBackgroundShadowStyle:styleEmbossDarkLineTopLeftBottom];
    
    [[[[[[UIView view] EFTag:203] EFBackgroundColor:[UIColor whiteColor]] EFFrame:CGRectMake(50, 40*12, 200,20)] EFOwner:self.view] showBackgroundShadowStyle:styleEmbossDarkLineTopRightBottom];
    
    [[[[[UIView viewAsButten] EFTag:7] EFText:@"blur+"]EFOwner:self.view]EFFrame:CGRectMake(300, 20, 50, 50)];
    [[[[[UIView viewAsButten] EFTag:8] EFText:@"blur-"]EFOwner:self.view]EFFrame:CGRectMake(300, 80, 50, 50)];
    [[[[[UIView viewAsLabel] EFTag:9] EFText:@".9"]EFOwner:self.view]EFFrame:CGRectMake(300, 140, 50, 50)];
    
    [[[[[UIView viewAsButten] EFTag:70] EFText:@"level+"]EFOwner:self.view]EFFrame:CGRectMake(300, 20+140+70, 50, 50)];
    [[[[[UIView viewAsButten] EFTag:80] EFText:@"level-"]EFOwner:self.view]EFFrame:CGRectMake(300, 80+140+70, 50, 50)];
    [[[[[UIView viewAsLabel] EFTag:90] EFText:@".9"]EFOwner:self.view]EFFrame:CGRectMake(300, 140+140+70, 50, 50)];
    
    [[[[[UIView viewAsButten] EFTag:700] EFText:@"offset+"]EFOwner:self.view]EFFrame:CGRectMake(300, 20+140+140+70+70, 50, 50)];
    [[[[[UIView viewAsButten] EFTag:800] EFText:@"offset-"]EFOwner:self.view]EFFrame:CGRectMake(300, 80+140+140+70+70, 50, 50)];
    [[[[[UIView viewAsLabel] EFTag:900] EFText:@".9"]EFOwner:self.view]EFFrame:CGRectMake(300, 140+140+140+70+70, 50, 50)];
}


- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

ON_Button(signal){
    UIButten *btn = signal.source;
    if ([signal is:[UIButten TOUCH_UP_INSIDE]]) {
        static CGFloat blur = .9;
        static CGFloat level = .3;
        static CGPoint point = {0,0};
        if ([btn is:@"leftBtn"]) {//customNavLeftBtn
            [self backAndRemoveWithAnimate:YES];
        }else if ([btn is:@"rightBtn"]){//customNavRightBtn
            [self open:URLFOR_controllerWithNav(@"Tmc") name:@"Tmc" animate:YES mapItem:^(HMURLMAPItem *mapItem) {
                mapItem.option = UIViewAnimationOptionTransitionFromRight;
            }];
        }else if (btn.tag==7){
            blur += .05;
//            blur = MAX(1, blur);
            [[self.view viewWithTag:3] shadowImageViewWithStyle:styleEmbossDarkLineLeftBottom].blur = blur;
            [[self.view viewWithTag:9] EFText:@(blur)];
        }else if (btn.tag==8){
            blur -= .05;
            [[self.view viewWithTag:3] shadowImageViewWithStyle:styleEmbossDarkLineLeftBottom].blur = blur;
            [[self.view viewWithTag:9] EFText:@(blur)];
        }else if (btn.tag==70){
            level += .05;
            //            blur = MAX(1, blur);
            [[self.view viewWithTag:3] shadowImageViewWithStyle:styleEmbossDarkLineLeftBottom].level = level;            [[self.view viewWithTag:90] EFText:@(level)];
        }else if (btn.tag==80){
            level -= .05;
            [[self.view viewWithTag:3] shadowImageViewWithStyle:styleEmbossDarkLineLeftBottom].level = level;
            [[self.view viewWithTag:90] EFText:@(level)];
        }else if (btn.tag==700){
            point.x += 2;
            point.y += 2;
            [[self.view viewWithTag:3] shadowImageViewWithStyle:styleEmbossDarkLineLeftBottom].shadowOffset = point;
        }else if (btn.tag==800){
            point.x -= 2;
            point.y -= 2;
            [[self.view viewWithTag:3] shadowImageViewWithStyle:styleEmbossDarkLineLeftBottom].shadowOffset = point;
            [[self.view viewWithTag:900] EFText:@(point.x)];
        }
        
    }
}

@end
